<?php
/*--------------------------------------------------------------
   HTML_mail_signature.php 2022-09-30
   Gambio GmbH
   http://www.gambio.de
   Copyright (c) 2022 Gambio GmbH
   Released under the GNU General Public License (Version 2)
   [http://www.gnu.org/licenses/gpl-2.0.html]
 -------------------------------------------------------------*/

// Get normal mail signature
$mailSignature = $this->query('SELECT `value` FROM `gx_configurations` WHERE `key` = "configuration/EMAIL_SIGNATURE"');

// Add the EMAIL_HTML_SIGNATURE configuration
$check = $this->query('SELECT `value` FROM `gx_configurations` WHERE `key` = "configuration/EMAIL_HTML_SIGNATURE"',
                      true);
if ($check->num_rows < 1) {
    $query     = "INSERT INTO `gx_configurations`
                    SET
                        `key` = 'configuration/EMAIL_HTML_SIGNATURE',
                        `value` = '" . $this->real_escape_string(nl2br($mailSignature[0]['value'])) . "';";
    $t_success &= $this->query($query, true);
}